/**
 * Creating a sidebar enables you to:
 - create an ordered group of docs
 - render a sidebar for each doc of that group
 - provide next/previous navigation

 The sidebars can be generated from the filesystem, or explicitly defined here.

 Create as many sidebars as you want.
 */

// populate examples from examples folder. Only include .mdx and .md files
const fs = require("fs");

// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */

// get examples from the file called examples-toc.json

const examples = JSON.parse(
  fs.readFileSync("./docusaurus/examples-toc.json", "utf8")
).find((x) => x.label === "Examples");

const sidebars = {
  // By default, Docusaurus generates a sidebar from the docs folder structure
  // tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
  docsSidebar: [
    {
      type: "doc",
      label: "Introduction",
      id: "index",
    },
    {
      type: "doc",
      label: "Getting Started",
      id: "guardrails_ai/getting_started",
    },
    {
      type: "doc",
      label: "Installation",
      id: "guardrails_ai/installation",
    },
    "the_guard",
    {
      type: "category",
      label: "How-to Guides",
      collapsed: true,
      items: [
        "how_to_guides/llm_api_wrappers",
        "how_to_guides/streaming",
        "how_to_guides/structured_data_with_guardrails",
        "how_to_guides/logs",
        "how_to_guides/rail",
        "how_to_guides/envvars",
        "how_to_guides/telemetry",
      ],
    },
    {
      type: "category",
      label: "API Reference",
      collapsed: true,
      items: [
        {
          type: "autogenerated",
          dirName: "api_reference_markdown",
        },
      ],
    },
    examples,
    // {
    //   type: "category",
    //   label: "Integrations",
    //   collapsed: true,
    //   items: [
    //     {
    //       type: "autogenerated",
    //       dirName: "integrations",
    //     },
    //   ],
    // },
    {
      type: "category",
      label: "Migration Guides",
      collapsed: true,
      items: [
        "migration_guides/0-4-migration",
        "migration_guides/0-3-migration",
        "migration_guides/0-2-migration",
      ],
    },
    {
      type: "doc",
      id: "faq",
      label: "FAQ",
    },
  ],
  hubSidebar: [
    "hub/introduction",
    "hub/getting_started",
    {
      type: "category",
      label: "How-to Guides",
      collapsed: true,
      items: [{
        type: "autogenerated",
        dirName: "hub/how_to_guides",
      }]
    }, {
      type: "category",
      label: "Concepts",
      collapsed: true,
      items: [{
        type: "autogenerated",
        dirName: "hub/concepts",
      }]
    }, {
      type: "category",
      label: "Reference",
      collapsed: true,
      items: [{
        type: "autogenerated",
        dirName: "hub/api_reference_markdown",
      }]
    }
  ],
};

module.exports = sidebars;
